﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AG.Data;
using System.IO;

namespace AG.MapEditor.Data
{
    public class AGMEContext
    {
        public static AGMEContext s_instance;

        public static AGMEContext Current
        {
            get
            {
                if (s_instance == null)
                {
                    s_instance = new AGMEContext();
                }
                return s_instance;
            }
        }

        public static void InitData(string dataFile)
        {
            AGDataLoader loader = new AGDataLoader();
            Current.Data = loader.Load(dataFile);

            Current.Resource = new AGResourceManager(new FileInfo(dataFile).Directory.FullName);
        }

        public AGData Data { get; private set; }

        public AGResourceManager Resource { get; private set; }

        public AGUnitStore UnitStore { get; private set; }

        public AGDataLoader DataLoader { get; private set; }

        public AGMapStore MapStore { get; private set; }

        public AGMEContext()
        {
            DataLoader = new AGDataLoader();

            MapStore = new AGMapStore();
        }
    }
}
